from selenium.webdriver.common.by import By

from base import Base

class Page(Base):
    # ANDROID_UIAUTOMATOR定位
    def sou(self):
        log=(By.ANDROID_UIAUTOMATOR,'new UiSelector().text("搜商品名称 作者 出版社 ISBN")')
        ele=self.find_ele(log)
        return ele
    # CLASS_NAME定位
    def suo(self):
        log=(By.CLASS_NAME,'android.widget.EditText')
        ele=self.find_ele(log)
        return ele
    # XPATH定位
    def shu(self):
        log=(By.XPATH,'//android.widget.TextView[@resource-id="com.kongfz.app:id/tvName" and @text="书"]')
        ele=self.find_ele(log)
        return ele
    # XPATH定位
    def tupian(self):
        log=(By.XPATH,'(//android.widget.ImageView[@resource-id="com.kongfz.app:id/ivPic"])[7]')
        ele=self.find_ele(log)
        return ele
    # ID定位
    def gouwuche(self):
        log=(By.ID,'com.kongfz.app:id/rlCart')
        ele=self.find_ele(log)
        return ele
    # XPATH定位
    def jiarugouwuche(self):
        log=(By.XPATH,'//android.widget.RelativeLayout[@resource-id="com.kongfz.app:id/rlAddCart"]')
        ele=self.find_ele(log)
        return ele
    # XPATH定位
    def fanhui1(self):
        log=(By.XPATH,'//androidx.compose.ui.platform.ComposeView[@resource-id="com.kongfz.app:id/compose_view"]/android.view.View/android.view.View[2]/android.view.View[1]')
        ele=self.find_ele(log)
        return ele
    # ID定位
    def fanhui2(self):
        log=(By.ID,'com.kongfz.app:id/rlBack')
        ele=self.find_ele(log)
        return ele
    # ID定位
    def qingkong(self):
        log=(By.ID,'com.kongfz.app:id/rlDel')
        ele=self.find_ele(log)
        return ele
    # XPATH定位
    def fanhui3(self):
        log=(By.XPATH,'//android.widget.RelativeLayout[@resource-id="com.kongfz.app:id/rlBack"]')
        ele=self.find_ele(log)
        return ele
    # 断言
    def duanyan(self):
        log = (By.XPATH, '//android.widget.RelativeLayout[@resource-id="com.kongfz.app:id/rlBack"]')
        ele = self.find_ele(log)
        return ele